package br.com.lopes.gci.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Constraint entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "constraint", catalog = "gcibd")
public class Constraint implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 2652823054321945208L;
	// Fields
	@Id
	@Column(name = "codigo", unique = true, nullable = false)
	private Integer codigo;
	
	@Column(name = "nome", length = 50)
	private String nome;
	
	@Column(name = "descricao", length = 70)
	private String descricao;
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "constraint")
	private List<Dominio> dominios = new ArrayList<Dominio>(0);

	// Constructors

	/** default constructor */
	public Constraint() {
	}

	/** minimal constructor */
	public Constraint(Integer codigo) {
		this.codigo = codigo;
	}

	/** full constructor */
	public Constraint(Integer codigo, String nome, String descricao,
			List<Dominio> dominios) {
		this.codigo = codigo;
		this.nome = nome;
		this.descricao = descricao;
		this.dominios = dominios;
	}

	// Property accessors
	
	public Integer getCodigo() {
		return this.codigo;
	}

	public void setCodigo(Integer codigo) {
		this.codigo = codigo;
	}

	
	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	
	public String getDescricao() {
		return this.descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	
	public List<Dominio> getDominios() {
		return this.dominios;
	}

	public void setDominios(List<Dominio> dominios) {
		this.dominios = dominios;
	}

}